package com.example.cdctravel

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.TextView
import androidx.fragment.app.Fragment
import com.example.cdctravel.LoginActivity
import com.example.cdctravel.MainChangemima

class TabFragment_Me : Fragment() {
    protected var mView: View? = null
    protected var mContext: Context? = null
    private var me_Tuichu: Button? = null
    private var me_Gaimima: Button? = null

    // private Button me_Gainicheng;
    private var me_Zhanghu: TextView? = null
    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        intiview()
        me_Tuichu!!.setOnClickListener {
            Data.sta_dl = false
            val intent = Intent(activity, LoginActivity::class.java)
            startActivity(intent)
            Data.images.clear()
            requireActivity().finish()
        }
        me_Gaimima!!.setOnClickListener {
            val intent = Intent(activity, MainChangemima::class.java)
            startActivity(intent)
            Data.images.clear()
            requireActivity().finish()
        }
        if (Data.sta_np == true) {
            me_Zhanghu!!.text = "当前账户为：" + Data.sta_name + "      密码为：" + Data.sta_password
        } else {
            me_Zhanghu!!.text = "当前为游客登陆"
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        mContext = activity
        mView = inflater.inflate(R.layout.me, container, false)
        return mView
    }

    override fun onPause() {
        super.onPause()
    }

    private fun intiview() {
        me_Tuichu = requireActivity().findViewById(R.id.me_tuichu)
        me_Zhanghu = requireActivity().findViewById(R.id.me_zhanghu)
        me_Gaimima = requireActivity().findViewById(R.id.me_gaimima)
        //me_Gainicheng=getActivity().findViewById(R.id.me_gainicheng);
    }
}
